﻿<%@ Page Language="C#" MasterPageFile="~/member/mMenber.master" AutoEventWireup="true" CodeBehind="sell_3.aspx.cs" Inherits="map.member.order.sell_3" Title="卖家-等待买家付款" %>
<%@ Register assembly="RuleCode.Common" namespace="RuleCode.Controls" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head2" runat="server">
    <link href="../../outstyle.css" rel="stylesheet" type="text/css" />
<script src="../../js/dropdowncontent.js" type="text/javascript"></script>
<style type="text/css">
    .ModifyPriceText
    {
        display:none;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
    <asp:Label ID="Label1" runat="server" Text="卖家-等待买家付款"></asp:Label>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
       Width="100%" DataKeyNames="RECID"
        BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" ForeColor="Black" GridLines="Vertical">
        <RowStyle BackColor="#F7F7DE" />
        <Columns>
            <asp:TemplateField HeaderText="图片"><ItemTemplate><asp:Image ID="Image2" runat="server" ImageUrl='<%#Eval("taobaopic_path")%>' Width="60px"  Height="60px" /></ItemTemplate></asp:TemplateField>
            <asp:BoundField DataField="buyer_nick" HeaderText="买家" />
            <asp:BoundField DataField="taobaoname" HeaderText="商品名称" />
            <asp:BoundField DataField="taobaoprice" HeaderText="单价" />
            <asp:BoundField DataField="taobaonum" HeaderText="数量" />
            <asp:BoundField DataField="taobaocreated" HeaderText="创建时间" /> 
            <asp:BoundField DataField="cbtrantype" HeaderText="物流方式" /> 
            <asp:TemplateField HeaderText ="状态">
                <ItemTemplate > 
                    <span style ="color:blue"><%#(Eval("cbtrantype").ToString()==TRADE_TranType.PostBySelf)?"等待卖家送货":"等待买家付款" %></span>
                </ItemTemplate>                
            </asp:TemplateField>
            <asp:TemplateField  HeaderText ="应付金额">
                <ItemTemplate>
                    <label id="PriceLabel" runat="server"><%#Eval("taobaopayment").ToString()%></label> 
                    <input  style =" display:none; width:100px"  type="text" value='<%#Eval("taobaopayment").ToString() %>' id="ModifyPriceInput"/>
                    <a href ="#" onclick ="modifyPrice(this);">修改价格</a>
                    <input  type="hidden" value='<%#Eval("RECID").ToString() %>'/>
                </ItemTemplate>
            </asp:TemplateField> 
        </Columns>
        <FooterStyle BackColor="#CCCC99" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
  
<hr />
<cc1:WebPager ID="WebPager1" runat="server" ControlToPaginate="GridView1"  OnPageIndexChanged ="WebPager1_PageIndexChanged"
    PageSize="20" />

<script type="text/javascript">
    function modifyPrice(thisObj) {
        var parentEle = thisObj.parentNode;
        if (thisObj.innerHTML == "修改价格") {
            parentEle.getElementsByTagName("label")[0].style.display = "none";
            parentEle.getElementsByTagName("input")[0].style.display = "block";
            thisObj.innerHTML = "保存";
        }
        else {                                                         
            var newPriceStr = parentEle.getElementsByTagName("input")[0].value;
            var reg0 = /^[0-9]*[1-9][0-9]*$/;
            var reg1 = /^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/;
            if (reg0.test(newPriceStr)==true || reg1.test(newPriceStr)==true) {
                var newPrice = parseFloat(newPriceStr);
                var recid = parentEle .getElementsByTagName("input")[1].value ;
                var result = AjaxFunction.ModifyTradePrice(recid ,newPrice );
                if (result.value != null && result.value == "") {              
                    parentEle.getElementsByTagName("input")[0].style.display = "none"
                    var labelEle = parentEle.getElementsByTagName("label")[0];
                    labelEle.style.display = "block";
                    labelEle.innerHTML = newPrice;
                    thisObj.innerHTML = "修改价格";
                }
            }
            else {
                alert("对不起，价格应该为大于0的数！");
            }
        }
    }

    function savePrice(thisObj) {
        return false;
    }
</script>
</asp:Content>
